package emulator.util;

import java.io.FileInputStream;
import java.io.IOException;

public class ByteHelper {

	public static int byteToInt(byte b) {
		int result = b;
		return result < 0 ? result + 256 : result;
	}

	public static int readWord(FileInputStream file_stream) throws IOException {
		int lo = file_stream.read();
		int hi = file_stream.read();
		return lo + (hi << 8);
	}

	public static int readWordBE(FileInputStream file_stream) throws IOException {
		int hi = file_stream.read();
		int lo = file_stream.read();
		return lo + (hi << 8);
	}
}
